<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="OrdenesDeTrabajo.aspx.cs" Inherits="Gestion_Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="contenido" Runat="Server">
    &nbsp;<asp:Panel ID="pnlFacturas" runat="server" Width="100%">
    <script language="javascript" type="text/javascript">
function intOnly(i) 
{
if(i.value.length>0) 
{
i.value = i.value.replace(/[^\d]+/g, ''); 
}
}
</script>
                    <asp:Panel ID="Panel1" runat="server" GroupingText="Ordenes de trabajo" Height="100%"
                        Width="100%">
        <table width="100%">
            <tr>
                <td align="left" colspan="1" rowspan="1" style="text-align: left" valign="top">
                    Estado :</td>
                <td align="left" colspan="1" rowspan="1" style="text-align: left" valign="top">
                    <asp:DropDownList ID="ddlEstado" runat="server" Width="150px">
                    </asp:DropDownList></td>
                <td align="left" colspan="4" rowspan="1" style="text-align: left;" valign="top">
                    Cliente :</td>
                <td align="left" colspan="1" rowspan="1" style="text-align: left; width: 314px;" valign="top">
                    <asp:DropDownList ID="ddlCliente" runat="server" Width="150px">
                    </asp:DropDownList>
                    <asp:Button ID="Button1" runat="server" CssClass="botonBuscar" OnClick="Button1_Click"
                        Text="Button" /></td>
                <td align="left" colspan="1" rowspan="1" style="text-align: left; width: 130px;" valign="top">
                    <strong>Detalle OT</strong></td>
                <td align="left" colspan="1" rowspan="1" style="text-align: left;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: left; width: 60px;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: left" valign="top">
                <a href="../Impresiones/OrdenDeTrabajo.aspx" target="popup" onClick="window.open(this.href, this.target, 'width=800,height=1000'); return false;">Imprimir</a>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="7" rowspan="15" style="text-align: left" valign="top">
                    <asp:GridView ID="gdvOrdenesDeTrabajo" runat="server" AutoGenerateColumns="False" DataKeyNames="Id" OnSelectedIndexChanged="gdvOrdenesDeTrabajo_SelectedIndexChanged" Height="100%">
                        <Columns>
                            <asp:TemplateField HeaderText="N&#176;" SortExpression="NumeroOrdenDeTrabajo">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("NumeroOrdenDeTrabajo") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("NumeroOrdenDeTrabajo") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Fecha" SortExpression="Fecha">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Fecha") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("Fecha", "{0:d}") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Cliente" SortExpression="Cliente">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("[Cliente.RazonSocial]") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Eval("Cliente.RazonSocial") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                             <asp:TemplateField HeaderText="Numero Factura" SortExpression="Numero Factura">
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Eval("Factura") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Monto Facturado" SortExpression="Monto Facturado">
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# "$ " + Eval("Monto") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Fecha Facturacion" SortExpression="Fecha Facturacion">
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# ((DateTime) Eval("FechaFacturacion")).ToString("dd-MM-yyyy") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField SelectText="Seleccionar" ShowSelectButton="True" />
                        </Columns>
                        <RowStyle CssClass="RowStyle" />
        <PagerStyle CssClass="PagerStyle" />
        <HeaderStyle CssClass="HeaderStyle" />
        <AlternatingRowStyle CssClass="AltRowStyle" />
        <SelectedRowStyle CssClass="SelectedRowStyle" />
                    </asp:GridView>
                    &nbsp;
                    &nbsp;&nbsp;</td>
                <td align="left" colspan="1" rowspan="3" style="text-align: right; width: 130px;" valign="top">
                    Numero OT:</td>
                <td align="left" colspan="1" rowspan="3" style="text-align: left;" valign="top">
                    <asp:Label ID="lblNumero" runat="server" Width="150px"></asp:Label></td>
                <td align="left" colspan="1" rowspan="3" style="text-align: right; width: 60px;" valign="top">
                    Cliente :</td>
                <td align="left" colspan="1" rowspan="3" style="text-align: left" valign="top">
                    <asp:Label ID="lblCliente" runat="server" Width="150px"></asp:Label></td>
            </tr>
            <tr>
            </tr>
            <tr>
            </tr>
            <tr>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 130px;" valign="top">
                    Fecha Ingreso :</td>
                <td align="left" colspan="1" rowspan="1" style="text-align: left;" valign="top">
                    <asp:Label ID="lblFecha" runat="server" Width="150px"></asp:Label></td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 60px;" valign="top">
                    Monto :</td>
                <td align="left" colspan="1" rowspan="1" style="text-align: left" valign="top">
                    <asp:Label ID="lblMonto" runat="server" Width="150px"></asp:Label></td>
            </tr>
            <tr>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 130px;" valign="top">
                    Fecha Facturacion :</td>
                <td align="left" colspan="1" rowspan="1" style="text-align: left;" valign="top">
                    <asp:Label ID="lblFechaFacturacion" runat="server" Width="150px"></asp:Label></td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 60px;" valign="top">
                    Detalle :</td>
                <td align="left" colspan="1" rowspan="1" style="text-align: left" valign="top">
                    <asp:Label ID="lblDetalle" runat="server" Width="150px"></asp:Label></td>
            </tr>
            <tr>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 130px;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 60px;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right" valign="top">
                </td>
            </tr>
            <tr>
                <td align="left" colspan="4" rowspan="1" style="text-align: left" valign="top">
                    <strong>Materiales asociados</strong></td>
            </tr>
            <tr>
                <td align="left" colspan="4" rowspan="1" style="text-align: right" valign="top">
                    <asp:DataList ID="dtlDetalleOrdenDeTrabajo" runat="server" Width="100%" Visible="False">
                        <HeaderTemplate>
                            <table class="HeaderStyle" width="100%">
                                <tr>
                                    <td style="width: 40%; text-align: left">
                                        Producto</td>
                                    <td style="width: 20%; text-align: left">
                                        Cantidad Asignada</td>
                                    <td style="width: 20%; text-align: left">
                                        Cantidad Utilizada</td>
                                    <td style="width: 20%; text-align: left">
                                        Monto</td>
                                </tr>
                            </table>
                            <hr />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <table style="border-right-style: none; border-right-color: black" width="100%">
                                <tr>
                                    <td style="width: 40%; text-align: left">
                                        <asp:Label ID="ProductoLabel" runat="server" Text='<%# Eval("Producto.Descripcion") %>'></asp:Label></td>
                                    <td align="right" style="width: 20%; text-align: right">
                                        <asp:Label ID="CantidadIngresoLabel" runat="server" Text='<%# Eval("Cantidad") %>'></asp:Label></td>
                                    <td align="right" style="width: 20%; text-align: right">
                                        <asp:Label ID="lblCantidadDespachada" runat="server" Text='<%# Eval("Despachado") %>'></asp:Label></td>
                                    <td align="right" style="width: 20%; text-align: right">
                                        <asp:Label ID="lblMonto" runat="server" Text='<%# "$ " + Eval("Monto") %>'></asp:Label></td>
                                </tr>
                            </table>
                        </ItemTemplate>
                        <SeparatorStyle BorderColor="Black" BorderStyle="Solid" />
                    </asp:DataList>
                    <asp:GridView ID="gdvDetalle" runat="server" AutoGenerateColumns="False" Width="100%">
                        <RowStyle CssClass="RowStyle" />
                        <Columns>
                            <asp:TemplateField HeaderText="Producto">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Producto.Descripcion") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Left" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Cantidad Asignada">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Cantidad") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Despachado">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Despachado") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Monto">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <asp:Label ID="lblTotal" runat="server" Text='<%# Eval("ValorTotal") %>'></asp:Label>
                                </FooterTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Eval("Monto") %>'></asp:Label>
                                </ItemTemplate>
                                <FooterStyle HorizontalAlign="Right" />
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Right" />
                            </asp:TemplateField>
                        </Columns>
                        <PagerStyle CssClass="PagerStyle" />
                        <SelectedRowStyle CssClass="SelectedRowStyle" />
                        <HeaderStyle CssClass="HeaderStyle" />
                        <AlternatingRowStyle CssClass="AltRowStyle" />
                    </asp:GridView>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="4" rowspan="1" style="text-align: left" valign="top">
                    <strong>Gastos asociados </strong>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="4" rowspan="1" style="text-align: right" valign="top">
                    <asp:GridView ID="gdvGastos" runat="server" AutoGenerateColumns="False" Width="100%">
                        <RowStyle CssClass="RowStyle" />
                        <Columns>
                            <asp:TemplateField HeaderText="Detalle">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Detalle") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Left" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Documento">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Documento") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="N&#176; Documento">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("NumeroDocumento") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="ValorTotal">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <asp:Label ID="lblTotal" runat="server" Text='<%# Eval("ValorTotal") %>'></asp:Label>
                                </FooterTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Eval("Monto") %>'></asp:Label>
                                </ItemTemplate>
                                <FooterStyle HorizontalAlign="Right" />
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Right" />
                            </asp:TemplateField>
                        </Columns>
                        <PagerStyle CssClass="PagerStyle" />
                        <SelectedRowStyle CssClass="SelectedRowStyle" />
                        <HeaderStyle CssClass="HeaderStyle" />
                        <AlternatingRowStyle CssClass="AltRowStyle" />
                    </asp:GridView>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 130px;" valign="top">
                </td>
                <td align="left" colspan="2" rowspan="1" style="text-align: right" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right" valign="top">
                    Costo Total:
                    <asp:Label ID="lblCosto" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 130px;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 60px;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right" valign="top">
                </td>
            </tr>
            <tr>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 130px;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 60px;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right" valign="top">
                </td>
            </tr>
            <tr>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 130px;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 60px;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right" valign="top">
                </td>
            </tr>
            <tr>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 130px;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right; width: 60px;" valign="top">
                </td>
                <td align="left" colspan="1" rowspan="1" style="text-align: right" valign="top">
                </td>
            </tr>
        </table>
                        &nbsp;
                    </asp:Panel>
        <br />
    </asp:Panel>
    &nbsp; &nbsp;
    &nbsp; &nbsp;&nbsp;
</asp:Content>

